# coding=utf-8
import arcpy
import json

arcpy.env.overwriteOutput = True
with open(r'E:\test\tpg1.json'.decode('utf-8'), 'rb') as file:
    content = file.read().decode('utf-8')
data = json.loads(content)

coordsList = data['geometry'][0]
ArcpyPoint_List = [arcpy.Point(*coords) for coords in coordsList]
ArcpyArray_List = arcpy.Array(ArcpyPoint_List)
ArcpyPolygon = arcpy.Polygon(ArcpyArray_List)

m_polygon = arcpy.CreateFeatureclass_management(r'e:\test','temp.shp','POLYGON')
arcpy.DefineProjection_management(m_polygon,coor_system='4490')
cs = arcpy.da.InsertCursor(m_polygon,'SHAPE@')
cs.insertRow([ArcpyPolygon])
del cs
# fl = []
# fl.append(ArcpyPolygon)
# arcpy.CopyFeatures_management(fl, r"e:\test\aaaa.shp")


# feature_info = [[[1, 2], [2, 4], [3, 7]],
#                 [[6, 8], [5, 7], [7, 2], [9, 5]]]
#
# features = []
#
# for feature in feature_info:
#     temp1 = [coords for coords in feature]
#     print temp1
#
#     # temp1 = [arcpy.Point(*coords) for coords in feature]
#     # print temp1
#     # temp1 = arcpy.Array([arcpy.Point(*coords) for coords in feature])
#     # print temp1
#     features.append(
#         arcpy.Polygon(
#             arcpy.Array([arcpy.Point(*coords) for coords in feature])))

# Persist a copy of the Polyline objects using CopyFeatures
# arcpy.CopyFeatures_management(features, "c:/geometry/polygons.shp")

